<?php

namespace app\models\db;

use Yii;

/**
 * This is the model class for table "t_ad_category".
 *
 * @property string $id
 * @property string $name
 * @property string $e_shop_id
 * @property string $description
 *
 * @property TAd[] $tAds
 */
class AdCategory extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 't_ad_category';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['id'], 'required'],
            [['id', 'e_shop_id'], 'string', 'max' => 36],
            [['name', 'description'], 'string', 'max' => 255],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'name' => 'Name',
            'e_shop_id' => 'E Shop ID',
            'description' => 'Description',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getTAds()
    {
        return $this->hasMany(TAd::className(), ['ad_category_id' => 'id']);
    }
}
